@svizzle/utils/array-[array-object]

Methods

(static) makeWithKeys(keys) → {function}

Source:
Since:
  • 0.2.0
See:

Return a function expecting an array of values and returning an object assigning the values to the provided keys.

Example
> makeWithLatLng = makeWithKeys(['lng', 'lat'])
> makeWithLatLng([1, 2])
{lng: 1, lat: 2}
> makeWithLatLng([10, 20])
{lng: 10, lat: 20}
Parameters:
Name Type Description
keys array

Array of keys

Returns:
  • Array -> Object
Type
function

(static) makeWithValues(values) → {function}

Source:
Since:
  • 0.2.0
See:

Return a function expecting an array of keys and returning an object assigning the keys to the provided values.

Example
> makeWithTheseValues = makeWithValues([1, 2])
> makeWithTheseValues(['lng', 'lat'])
{lng: 1, lat: 2}
> makeWithTheseValues(['foo', 'bar'])
{foo: 1, bar: 2}
Parameters:
Name Type Description
values array

Array of values

Returns:
  • Array -> Object
Type
function